﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CNVP.JShop.UI;

namespace CNVP.JShop.Web.Admin.CommonWindows
{
    public partial class AjaxBranksIDS : AdminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string html = "";
            html = "<select name=\"listBranks\" id=\"listBranks\" style=\"width:160px;\">";
            html += "<option value=\"0\">--请选择--</option>";
            try
            {
                if (!string.IsNullOrEmpty(Request.QueryString["ProductTypeID"]) && Request.QueryString["ProductTypeID"].ToString() != "0")
                {
                    int ProductTypeID = Convert.ToInt32(Request.QueryString["ProductTypeID"]);
                    string lbProBrandID = Request.QueryString["lbProBrandID"];
                    var model_ProTypeRefBranks=new BLL.CNVP_ProTypeRefBranks().GetSingle_CNVP_ProTypeRefBranksByProductTypeID(ProductTypeID);
                    if (model_ProTypeRefBranks != null)
                    {
                        string _BranksIDS = model_ProTypeRefBranks.BranksIDS;
                        if (!string.IsNullOrEmpty(_BranksIDS))
                        {
                            string[] ProTypeRefBranks = _BranksIDS.Split(Convert.ToChar(","));
                            for (int i = 0; i < ProTypeRefBranks.Length; i++)
                            {
                                string select_Str = "";
                                if (ProTypeRefBranks[i].ToString() == lbProBrandID)
                                {
                                    select_Str = "selected='selected'";
                                }
                                html += "   <option value=\"" + ProTypeRefBranks[i].ToString() + "\" " + select_Str + ">";
                                var model_Branks = new BLL.CNVP_Branks().GetSingle_CNVP_BranksById(Convert.ToInt32(ProTypeRefBranks[i]));
                                if (model_Branks != null)
                                {
                                    html += "       " + model_Branks.BrankName + "";
                                }
                                html += "   </option>";
                            }
                        }
                    }
                }
            }
            catch { }
            html += "</select>";
            Response.Write(html);
        }
    }
}